<%
Private Function GetMenuByUserID(UserId, resPPath)
''查找某个用户对应的权限对应的资源的信息，生成菜单
''Response.Write "--<<<" & UserId & "-----" & resPPath & ">>>---"
	Dim menuHtml, menuHtmlTemp
	menuHtml=""
	menuHtmlTemp=""
	Dim rsObjT,strSql
	 Set rsObjT = Server.CreateObject("ADODB.Recordset")
	strSql=""
	strSql=strSql & " SELECT DISTINCT T_RES.* "
	strSql=strSql & " FROM T_RES INNER JOIN T_ROLE_RES INNER JOIN  T_USER_ROLE "
	strSql=strSql & " ON T_ROLE_RES.role_id = T_USER_ROLE.role_id ON T_RES.id = T_ROLE_RES.res_id "
	strSql=strSql & " WHERE (T_USER_ROLE.user_id ="&UserId&") AND (T_RES.res_ppath = '"& resPPath &"') "
	''Response.Write strSql&"-----"
	rsObjT.Open strSql, Conn, 1, 3
			If rsObjT.BOF And rsObjT.EOF Then 
				'nothing
			'end if	 
			'UserID=ReplaceBadChar(Trim(rsObjT("UserID")))
		 	else 
	      Do While Not rsObjT.EOF
	        if ("0_"=resPPath)then 
	        	'' Response.Write strSql&"-----"
	        	menuHtml=menuHtml & "<li><a href='" & rsObjT("res_url")&"' id='" & rsObjT("menu_code") & "' name='" & rsObjT("menu_code") & "'><strong><span>" & rsObjT("menu_name") & "</span></strong></a>"
	        	menuHtmlTemp=GetMenuByUserID(UserId,rsObjT("res_ppath")&rsObjT("id")&"_")
	        	if (""<>Trim(menuHtmlTemp)) then 
		        	menuHtml=menuHtml & "<div class='menu' style='display:none'><ol>" & menuHtmlTemp & "</ol></div>"
		        end if
	        	menuHtml=menuHtml & "</li>"
	        else 
	        	''Response.Write strSql&"-----"
	        	menuHtml=menuHtml & "<li><a href='" & rsObjT("res_url")&"'>" & rsObjT("menu_name")&"</a></li>"
	        end if 
	     		rsObjT.MoveNext 
	          '''If i >= MaxPerPage Then Exit Do
	      Loop
	      '' Response.Write strHtml
			end if 
			rsObjT.close
			Set rsObjT = Nothing 

 '释放数据库链接
	''call CloseConn	 


GetMenuByUserID = menuHtml
End Function
%>


<!--begin navigation-->
<div class="navigation nav-orange" id="navigation" name="navigation">
	<div class="nav-tabs">
		<ul>
			
	 <% 
	 	'菜单示例
	 	'	<li><a href="/console/point/point.php" name="point"><strong><span>积分管理</span></strong></a>
		'		<div class="menu" style="display:none">
		'			<ol>
		'				<li><a href="/console/point/point.php">消费积分</a></li>
		'				<li><a href="/console/point/coin.php">花生米</a></li>
		'			</ol>
		'		</div>
		'	</li>	 	
	 	Response.Write ""&GetMenuByUserID(Session("UserID"),"0_")	
	%>		
 
	 	 
 
		</ul>
	</div>
</div>
<!--script type="text/javascript">//$("#navigation").menu('point');</script-->
<!--end navigation-->



